﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace PlantsVsZombies
{
    public abstract class VisibleGameEntity : GameObject
    {
        private int _nSprites;
        private List<Sprite> _sprites;

        private Vector2 _position;
        private Vector2 _size;

        public Vector2 Position
        {
            get { return _position; }
            set { _position = value; }
        }

        public Vector2 Size
        {
            get { return _size; }
            set { _size = value; }
        }

        public int NSprites
        {
            get { return _nSprites; }
            set { _nSprites = value; }
        }

        public List<Sprite> Sprites
        {
            get { return _sprites; }
            set { _sprites = value; }
        }

        public virtual void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < _nSprites; i++)
            {
                _sprites[i].Position = _position;
                _sprites[i].Draw( spriteBatch);
            }
        }
        public virtual void Update(GameTime gameTime)
        {
            for (int i = 0; i < _nSprites; i++)
                _sprites[i].Update(gameTime);
        }
        public bool IsClick(Vector2 pos)
        {
            return _sprites[0].IsClicked(pos);
        }

        
        
    }
}
